package com.geekaca.iobuffer;

import java.io.*;

public class HelloBufferStream3 {
    public static void main(String[] args) {
        try (
                InputStream is = new FileInputStream("W:\\2023中澳\\小组照-\\单人照\\陈紫涵\\XXA_7580.JPG");
                FileOutputStream fos = new FileOutputStream("studyIOBuffer\\copy2.png");
        ) {

            BufferedInputStream bis = new BufferedInputStream(is);
            BufferedOutputStream bos = new BufferedOutputStream(fos);

            int len = -1;
            byte[] buffer = new byte[512];
            while ((len = bis.read(buffer)) != -1) {
                bos.write(buffer, 0, len);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
